<template>
	<view class="content">
		<image src="/static/logo.png" class="content_img" mode=""></image>
		<view class="loginbox u-radius-6 u-p-50 ">
			<view class="">
				越努力越幸运!
			</view>
			<input type="text" v-model="account" placeholder="请输入账号" class="inputbox" />
			<input type='password' v-model="pwd" placeholder="请输入密码" class="inputbox" />
			
			<view class="u-m-t-50" @click="tologin">
				<u-button type="success" text="开始战斗"></u-button>
			</view>
		</view>
	</view>

</template>

<script>
	export default {
		data() {
			return {
				account:'',
				pwd:'',
			};
		},
		methods:{
			tologin(){
				if(!this.account){
					return this.$toast('请输入账号')
				}if(!this.pwd){
					return this.$toast('请输入密码')
				}
				
				this.$api.post('/passport/delivery_login',{
					username:this.account,
					password:this.pwd
				}).then(res=>{
					uni.redirectTo({
						url:'/pages/index/index'
					})
					uni.setStorageSync('token',res.data.token)
				})
			},
		}
	}
</script>

<style lang="scss">
	page {
		overflow: hidden;
	}


	.content_img {
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		z-index: -1;
	}
	.loginbox{
		background-color: #fff;
		width: 500rpx;
		margin: 100rpx auto;
	}
	.inputbox{
		padding: 10rpx;
		border: 1rpx solid #999;
		border-radius: 6rpx;
		margin-top: 40rpx;
	}
</style>